#include "RigidBody.h"

NS_B2D_BEGIN
	
b2Body* RigidBody::createBody(b2World& world, const RigidBodyDef& def)
{
	auto body = world.CreateBody(&def);
	if(body != nullptr)
	{
		for(const auto& f : def.fixtures)
		{
			b2FixtureDef fix = f;
			for(const auto& s : f.shapes)
			{
				fix.shape = s.get();
				body->CreateFixture(&fix);
			}
		}
	}
	return body;
}

NS_B2D_END
